import React, { useState, useEffect, memo } from 'react'
import { useMountedState } from './hooks/useMountedStete'
function Child({isMounted}) {
  console.log('Child render')
  return (
    <div>{isMounted() ? 'mounted' : 'pending'}</div>
  )
}
Child = memo(Child)
export default function App() {
  const isMounted = useMountedState()
  const [count, setCount] = useState(0)
  useEffect(() => {
    setTimeout(() => {
      setCount(1)
    }, 1000)
  }, [])
  return (
    <div>
      {/* <div>{isMounted() ? 'mounted' : 'pending'}</div> */}
      <Child isMounted={isMounted}></Child>
    </div>
  )
}
